<extend name="Public/base"/>
<block name="style">
    <style type="text/css">
        ul li a{color: black;}
    </style>
</block>
<block name="body">
    <div class="tw-layout">
    	<div class="tw-list-hd">
            {:isset($info['id'])?'编辑':'新增'}<if condition="$type eq 0">APP启动页<elseif condition="$type eq 1" />APP轮播图<elseif condition="$type eq 2" />APP登录背景图</if>图片
        </div>
		
	    <div class="tw-list-wrap tw-edit-wrap">
            <form action="__SELF__" method="post" class="form-horizontal ajaxForm">
                <div class="form-item">
                    <if condition="$type eq 0">
                        <label class="item-label">APP启动页标识名称<span class="check-tips"><b>*</b>（用于后台展示APP启动页名称标题）</span></label>
                    <elseif condition="$type eq 1" />
                        <label class="item-label">APP轮播图片标识名称<span class="check-tips"><b>*</b>（用于后台展示APP轮播图片名称标题）</span></label>
                    <elseif condition="$type eq 2" />
                        <label class="item-label">APP手机登录页面图片标识名称<span class="check-tips"><b>*</b>（用于后台展示APP手机登录页面图片名称标题）</span></label>
                    </if>
                    <div class="controls">
                        <input type="text" class="text input-large" name="title" value="{$info.title}" placeholder="图片标识名称">
                    </div>
                </div>

                <div class="form-item">
                    <label class="item-label">形象图片<span class="check-tips"><b>*</b><if condition="$type eq 0">（启动页的形象图片,请上传1080px*1920px的图片）<elseif condition="$type eq 1" />（轮播图的形象图片,请上传1080px*590px的图片）<elseif condition="$type eq 2" />（手机登录背景的形象图片,请上传1080px*1920px的图片）</if></span></label>
                    <div class="controls">
                        <div>
                            <img src="{$info.img}" style="width:129px;" id="img_"/>
                        <div>
                        <input type="hidden" value="{$info.img}" name="img" id="img"/>
                        <input class="btn btn-default btn-xs" type="button" value="上传" id="btnUpload" />
                        <input class="btn btn-danger btn-xs" type="button" value="删除" onclick="delFile($('#img').val(), '')" id="btn_delete_" />
                        <if condition="$info.img eq ''">
                            <script>
                                $("#img_, #btn_delete_").hide();
                            </script>
                        </if>
                    </div>
                </div>

                <if condition="$type eq 1">
                    <div class="form-item">
                        <label class="item-label">点击打开内容<span class="check-tips"><b>*</b>（用于显示点击轮播图展示的内容）</span></label>

                        <div class="form-item">
                            <div class="tw-tab-panel" data-tab-idx="8mFNtKjnCr" style="display: block;">
                                <div class="tw-panel-cnt">
                                    <div class="tw-tabs">
                                        <ul class="tw-tabs-nav ui-sortable" style="width:702px;" id="my_tabs">
                                            <li class="tw-nav-item" data-tab-idx="new-article" data-open_type="3">
                                                <a href="javascript: void(0)">打开自定义的文章内容</a>
                                            </li>
                                            <li class="tw-nav-item" data-tab-idx="url" data-open_type="1">
                                                <a href="javascript: void(0)">打开外部链接</a>
                                            </li>
                                            <li class="tw-nav-item" data-tab-idx="article" data-open_type="2">
                                                <a href="javascript: void(0)">打开文章</a>
                                            </li>
                                        </ul>
                                        <div class="tw-tabs-bd" style="width:700px;">
                                            <div class="tw-tab-panel" data-tab-idx="new-article" style="display: block;">
                                                <div class="tw-panel-cnt">
                                                    <div class="content_desc">
                                                        <div class="form-item">
                                                            <label class="item-label">文章内容</label>
                                                            <div class="controls">
                                                                <script id="content_desc" name="content" type="text/plain">{$info['content']|htmlspecialchars_decode}</script>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tw-tab-panel" data-tab-idx="url" style="display: none;">
                                                <div class="tw-panel-cnt">
                                                    <div class="controls openurl">
                                                        外部链接url ：<input type="text" class="text input-large" name="url" value="{$info.url}" placeholder="必须以http://开头">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="tw-tab-panel" data-tab-idx="article" style="display: none;">
                                                <div class="tw-panel-cnt">
                                                     <div class="controls openarticle">
                                                        选择打开文章 ：<input id="article_name" type="text" class="text" value="{$info['articleName']}" placeholder="选择的文章标题" disabled="disabled"><input type="hidden" name="article_id" value="0" id="article_id"><div class="btn" onclick="selectArticle()">点击选择</div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>                 
                </if>
                <div class="form-item">
                    <label class="item-label">是否禁用<span class="check-tips"></span></label>
                    <div class="controls">
                        <if condition="$info.disabled eq 0">
                            <label class="radio"><input type="radio" value="0" name="disabled" checked="checked" >正常</label>
                            <label class="radio"><input type="radio" value="1" name="disabled" >禁用</label>
                        <else  />
                            <label class="radio"><input type="radio" value="0" name="disabled" >正常</label>
                            <label class="radio"><input type="radio" value="1" name="disabled" checked="checked" >禁用</label>
                        </if>
                    </div>
                </div>    

                <div class="form-item">
                    <label class="item-label">排序</label>
                    <div class="controls">
                        <input type="text" class="text input-small" name="sort" value="{$info.sort|default=0}">
                    </div>
                </div>

                <div class="tw-tool-bar-bot">
                    <input type="hidden" value="{$info['id']}" name="id">
                    <input type="hidden" value="{$type}" name="type">
                    <if condition="$type eq 1">
                        <input type="hidden" value="{$info['open_type']|default=3}" name="open_type" id="open_type">
                    </if>
                    <button type="submit" class="tw-act-btn-confirm">提交</button>
                    <button type="button" onclick="goback()" class="tw-act-btn-cancel">返回</button>
                </div>
            </form>
	    </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ajaxupload.js"></script>
    <script type="text/javascript" charset="utf-8" src="__COMMON__/js/imgupload.js"></script>
    <script>
        var ue = UE.getEditor('content_desc', {
            autoHeightEnabled: false,
            initialFrameWidth: '675',
            initialFrameHeight: 350
        });

        $(function(){
            ajaxUpload('#btnUpload', '#img', 'Banner', '');

            var open_type = $('input[name=open_type]').val();
            $('#my_tabs li[data-open_type='+ open_type +']').click();

            $('#my_tabs li').on('click', function(){
                $("#open_type").val($(this).attr('data-open_type'));
            });
        })

        // 查询文章列表
        function selectArticle(){
            layer.open({
            type: 2,
            title: '文章列表',
            shadeClose: true,
            shade: 0.8,
            area: ['800px', '500px'],
            content: "{:U('Admin/ArticleCategory/selectArticle')}" //iframe的url
        }); 
            // openLayerPopup("{:U('Admin/ArticleCategory/selectArticle')}","文章列表",null);
        }
    </script>
</block>